﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Administrator/Views/Shared/admin.master" Inherits="System.Web.Mvc.ViewPage<CollegeWebsite.Areas.Administrator.Models.Department>" %>
<%@ Import Namespace="CollegeWebsite.Areas.Administrator.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
 <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm()) {%>
        <%= Html.ValidationSummary(true) %>

        <fieldset>
            <legend>Create new department</legend>
                                 
            <div class="editor-label">
             Department Name:
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.DepartmentName) %>
                <%= Html.ValidationMessageFor(model => model.DepartmentName) %>
            </div>
            
            <div class="editor-label">
             Faculty Name:
            </div>
            <div class="editor-field">
                <%= Html.DropDownListFor(model => model.FacultyID,new SelectList((List<Faculty>)ViewData["faculty"],"FacultyID","FacultyName")) %>
                <%= Html.ValidationMessageFor(model => model.FacultyID) %>
            </div>
            
            <div class="editor-label">
             Description
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.DepartmentDescription, new { @class = "jwysiwyg" })%>
                <%= Html.ValidationMessageFor(model => model.DepartmentDescription) %>
            </div>
            
            <div class="editor-label">
               Enable this department ?
            </div>
            <div class="editor-field">
                <%= Html.CheckBoxFor(model => model.Status) %><span id="StatusLabel" style="vertical-align: middle">Enable</span>
                
            </div>
            
            <p>
                <input type="submit" value="Create" class="btn" /> 
        <%= Html.ActionLink("Back to List", "Index","Department",new{@class="btn"}) %>
            </p>
        </fieldset>

    <% } %>

   

    <script type="text/javascript">
        $(document).ready(function() {
            if ($('input[id="Status"]').val() == 'true') { $('input[id="Status"]').attr('checked', 'checked'); };
            $('input[id="Status"]').click(function() {
                var state = ($(this).attr('checked')) ? "Enable" : "Disable";
                $('#StatusLabel').text(state);
            });
            $('#StatusLabel').click(function() {
                $('input[id="Status"]').trigger('click');
            });
        });
    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="TitleContentPlaceHolder" runat="server">
</asp:Content>





